: x ( addr len -- true| n false ) $number if abort" nan" then cr ." number = " . ; ok
|
Enter the string "123" then enter x.
0 > " 123" x
number = 123 ok
|
X determined the string was indeed a number string, so the output was the number 123. Now try a non-numeric string:
nan stands for "not a number" as expected. Now let's enter the number 123.
0 > 123 x
DEFAULT CATCH!, code=300 at %SRR0: ff80bed0 %SRR1: 0000b030
ok
|
Since X expected a numeric string which has an address and length and 123 is a single parameter, the Forth interpreter aborted the word X and cleared the stack.
|